package com.hncu.array;

import com.hncu.domain.Student;

public class Demo1 {
    public static void main(String[] args) {
        //创建对象
        Student stu1 = new Student();
        Student stu2 = new Student();
        Student stu3 = new Student();
        //给对象赋初始值
        stu1.setName("张三");
        stu2.setName("李四");
        stu3.setName("王五");
        stu1.setAge(23);
        stu2.setAge(24);
        stu3.setAge(25);
        //创建数组
        Student[] sturr = new Student[3];
        //给数组赋值
        sturr[0] = stu1;
        sturr[1] = stu2;
        sturr[2] = stu3;
        for (int i = 0; i < sturr.length; i++) {
            System.out.println(sturr[i].getAge()+"..."+sturr[i].getName());
        }
    }
}
